home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / oop_tp55.zip / LIST10_3.PAS < prev    next >
Pascal/Delphi Source File  |  1990-02-19  |  1KB  |  56 lines

  1. program List10_3;
  2.  
  3. uses Graph, Mouse, Crt, ProRobot, List10_2;
  4.  
  5. var
  6.    Arm : RobotArm;
  7.    P0 : Point;
  8.  
  9.    x, y : integer;
  10.  
  11.    GraphDriver : integer;
  12.    GraphMode   : integer;
  13.    ErrorCode   : integer;
  14.    GlobalAnchorX,
  15.    GlobalAnchorY,
  16.    ArmLength : integer;
  17.  
  18. begin
  19.      GraphDriver := Detect;
  20.      InitGraph(GraphDriver, GraphMode, 'E:\TP');
  21.      ErrorCode := GraphResult;
  22.      if ErrorCode <> grOK then
  23.         Writeln('Graphics error');
  24.  
  25.      GlobalAnchorX := Round(GetMaxX/3);
  26.      GlobalAnchorY := Round(GetMaxY/2);
  27.      ArmLength     := Round(GetMaxY/2.4);
  28.  
  29.      Graph.SetColor(white);
  30.      SetTextStyle( DefaultFont, HorizDir, 2);
  31.      OutTextXY( Round(GetMaxX/1.5), Round(GetMaxY*4/5), 'Robot ''A''' );
  32.      Arm.Init( GlobalAnchorX, GlobalAnchorY, ArmLength,
  33.                0, true );
  34.      Arm.ShowLimit;
  35.      P0.Init( 0,0);
  36.      if MouseInit = true then
  37.         ;
  38.      MouseShow;
  39.      repeat
  40.            repeat
  41.            until MouseLPressed or KeyPressed;
  42.            if not KeyPressed then
  43.               begin
  44.               P0.Hide;
  45.               repeat
  46.                     MouseCoords( x, y );
  47.               until MouseLReleased;
  48.               MouseHide;
  49.               P0.Init( x, y );
  50.               P0.Show;
  51.               Arm.MoveTo( P0 );
  52.               P0.Show;  { again in case any part of the box was trashed }
  53.               MouseShow;
  54.               end;
  55.      until KeyPressed;
  56. end.